﻿@using ZKEACMS.FormGenerator.Models
@using ZKEACMS.FormGenerator
@model FormData
@{
    Style.Reqiured("form-widget").AtFoot();
    Script.Reqiured("distpicker").AtFoot();
}
<div class="row">
    <div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                @L("表单数据")
                @Model.Form.Title
            </div>
            <div class="panel-body form-widget">
                <table class="table table-striped table-bordered ">
                    <thead>
                        <tr>
                            <th>@L("字段")</th>
                            <th>@L("值")</th>
                        </tr>
                    </thead>
                    <tbody>
                        @for (int i = 0; i < Model.Form.FormFields.Count; i++)
                        {
                            <tr>
                                <td>
                                    @Model.Form.FormFields[i].DisplayName
                                </td>
                                <td>
                                    @Html.DisplayFieldValue(Model.Form.FormFields[i])
                                </td>
                            </tr>
                        }
                    </tbody>
                </table>

            </div>
            <div class="panel-footer">
                <a class="btn btn-default cancel">@L("返回")</a>
                @if (Authorizer.Authorize(ZKEACMS.FormGenerator.PermissionKeys.ExportFormData))
                {
                    <a class="btn btn-primary" href="@Url.Action("Export",new { id = Model.ID })" download="@Model.Form.Title">
                        @L("导出Excel")
                    </a>
                    <a class="btn btn-danger" href="@Url.Action("ExportForm",new { id = Model.FormId })" download="@Model.Form.Title">
                        @L("导出所有数据")
                        @Model.Form.Title
                    </a>
                }

            </div>
        </div>
    </div>
    <div class="col-md-6">
        <div class="panel panel-default">
            <div class="panel-heading">
                @Model.Form.Title
            </div>
            <div class="panel-body form-widget">
                <div class="row">
                    @for (int i = 0; i < Model.Form.FormFields.Count; i++)
                    {
                        <div class="@Model.Form.FormFields[i].Column">
                            @Html.EditorFor(n => n.Form.FormFields[i], "Form.{0}".FormatWith(Model.Form.FormFields[i].Name))
                        </div>
                    }
                </div>
            </div>
        </div>
    </div>
</div>

